Enable MSBuild server by default in MSBuildForwardingApp - #55231
Conversation
Test failure analysis: real bug, already fixed upstream, blocked on an MSBuild version lagThe CI test failures on this PR (e.g. Root causeWith This is exactly dotnet/msbuild#14077 ("Fix TerminalLogger auto-detection under MSBuild Server", fixes dotnet/msbuild#13940), merged 2026-06-17, which explicitly calls out the Windows Reproduction (pure CLI, no test harness)Using the SDK built from this branch, a redirected
Deterministic, reproduces without any test framework. Verified end-to-end that the daily .NET 11 SDK ( Why CI still fails (the blocker)The SDK builds against / redistributes MSBuild via That MSBuild is source-dated 2026-06-11 — six days before the fix. Note this is out of sync with What would unblock itThe SDK needs a post-#14077 MSBuild (>= Happy to do whichever the maintainers prefer. |
Update: MSBuild bump to 26325 fixed the Windows TL failures; residual failures are a separate Unix server bugPushed Remaining 3 failures (all Unix)
The first two are the same root cause, and it is not the TerminalLogger bug: with the server enabled on Unix, an MSBuild invocation that succeeds (0 errors, Net
This looks like it needs an upstream MSBuild fix (or confirmation that these are acceptable/known-flaky) before the server can be defaulted on for Unix. Flagging for maintainer guidance. |
Local repro investigation of the residual Unix failures (WSL Ubuntu 24.04)To determine whether a newer MSBuild would fix the two Unix "exit code 1 on a successful build" failures, I tried to reproduce them locally with the exact SDK CI uses (
So the exit-code race is rare and timing/parallelism-dependent — it did not reproduce once locally, yet CI hits ~1 test per run (a different test each time). I therefore can't confirm locally whether bumping MSBuild further (e.g. to Summary for maintainers
|
31ecd76 to
d6d5ade
Compare
Update: rebased on main + bumped MSBuild to 26360 (includes the exit-code fix #14251)Rebased onto current Issue #14172 is an exact match for the two residual Unix failures: on Linux with the MSBuild Server, a successful build intermittently exits 1 with Changes in this push
Local Debug build is clean and the previously-failing Note: the |
|
there seems to be no problem after this #55245 |
d6d5ade to
28de084
Compare
Change DOTNET_CLI_USE_MSBUILD_SERVER to default to true so the MSBuild server is enabled when the user hasn't specified anything about it. An explicit MSBUILDUSESERVER value (or DOTNET_CLI_USE_MSBUILD_SERVER=false) is still respected as an opt-out. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 499249b7-514f-4ecf-88bc-2466455069c5
28de084 to
98217a4
Compare
|
Azure Pipelines: Successfully started running 1 pipeline(s). 2 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
Enables the MSBuild server by default for the CLI’s MSBuild forwarding path (MSBuildForwardingApp), while still respecting explicit user opt-outs via DOTNET_CLI_USE_MSBUILD_SERVER=false or MSBUILDUSESERVER=0.
Changes:
- Default
DOTNET_CLI_USE_MSBUILD_SERVERevaluation totrueinMSBuildForwardingAppWithoutLogging. - Only force
MSBUILDUSESERVER=1when the user hasn’t already setMSBUILDUSESERVER. - Add a unit test asserting the default-on behavior for
MSBuildForwardingApp.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/dotnet.Tests/CommandTests/MSBuild/GivenMsbuildForwardingApp.cs | Adds coverage for the new default-on MSBuild server behavior. |
| src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs | Switches the default to enabling MSBuild server and refines env-var forcing logic to respect user overrides. |
|
codeflow this was dependending on to fix msbuild bugs merged so the tests pass |
|
I noticed a perf improvement in diff where improvement occurred: dotnet/dotnet@cb8306a...e78e1a0 Any chance this PR could be the reason? |
|
If you are interested here is a link to the dashboard : dashboard |
|
@Nigusu-Allehu agent inspected the traces and the scenario source and yes it's explainable by this change. |
Good point. The current implementation only waits for the warmup restore's client process to finish. it doesn't kill the MSBuild daemons. Rather than just fixing this, maybe we add it as its own scenario: add a warm variant, and keep a cold-process variant that runs dotnet build-server shutdown + kills lingering msbuild* / dotnet* before the measured restore. The delta between them would tell us exactly how much the daemon processes are helping, and guard against regressions in reuse effectiveness. |
Summary
Makes the MSBuild server enabled by default in
MSBuildForwardingApp. When the user hasn't specified anything about the MSBuild server, it is now turned on.Changes
DOTNET_CLI_USE_MSBUILD_SERVERnow defaults totrue(wasfalse).MSBUILDUSESERVER=1is only forced on when the user hasn't already setMSBUILDUSESERVERthemselves, so an explicit opt-out (MSBUILDUSESERVER=0) orDOTNET_CLI_USE_MSBUILD_SERVER=falseis still respected.ItEnablesMSBuildServerByDefaulttest verifying the default-on behavior.Behavior change
DOTNET_CLI_USE_MSBUILD_SERVER=falseorMSBUILDUSESERVER=0.Testing
Ran
GivenMsbuildForwardingApplocally against a full Debug build; the new test passes and existing server-related tests pass.